package com.ebo.httpcall4j.core.model.enums;

import lombok.Getter;

/**
 * HTTP内容类型枚举
 */
@Getter
public enum ContentType {
    APPLICATION_JSON("application/json"),
    APPLICATION_X_WWW_FORM_URLENCODED("application/x-www-form-urlencoded"),
    TEXT_PLAIN("text/plain"),
    ;

    private final String value;

    ContentType(String value) {
        this.value = value;
    }

    public static ContentType fromValue(String value) {
        for (ContentType contentType : values()) {
            if (contentType.value.equalsIgnoreCase(value)) {
                return contentType;
            }
        }
        throw new IllegalArgumentException("Unknown content type: " + value);
    }

}